import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProductUrlVO, ProductUrlForm, ProductUrlQuery } from '@/api/oce/productUrl/types';

/**
 * 查询端原生短剧链接列表
 * @param query
 * @returns {*}
 */

export const listProductUrl = (query?: ProductUrlQuery): AxiosPromise<ProductUrlVO[]> => {
  return request({
    url: '/oce/productUrl/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询端原生短剧链接详细
 * @param id
 */
export const getProductUrl = (id: string | number): AxiosPromise<ProductUrlVO> => {
  return request({
    url: '/oce/productUrl/' + id,
    method: 'get'
  });
};

/**
 * 新增端原生短剧链接
 * @param data
 */
export const addProductUrl = (data: ProductUrlForm) => {
  return request({
    url: '/oce/productUrl',
    method: 'post',
    data: data
  });
};

/**
 * 修改端原生短剧链接
 * @param data
 */
export const updateProductUrl = (data: ProductUrlForm) => {
  return request({
    url: '/oce/productUrl',
    method: 'put',
    data: data
  });
};

/**
 * 删除端原生短剧链接
 * @param id
 */
export const delProductUrl = (id: string | number | Array<string | number>) => {
  return request({
    url: '/oce/productUrl/' + id,
    method: 'delete'
  });
};
